package battleOfTheSevenSeas.Serveur;

import java.io.*;
import java.net.*;

public class Serveur extends Thread {

	protected static final int PORT = 2012;
	protected ServerSocket ecoute;

	public Serveur(){
		try {
			ecoute = new ServerSocket(2012);
			System.out.println(ecoute.getInetAddress());
		}
		catch (IOException ioe){
			System.err.println(ioe.getMessage());
			System.exit(1);
		}
		System.out.println("Serveur en écoute sur le port : " + PORT);
		this.start();
	}

	public void run(){
		while(true)
		{
			Socket connectionSocket;
			try {
				connectionSocket = ecoute.accept();
				new Connexion(connectionSocket);
				
			} catch (IOException ioe) {
				System.err.println(ioe.getMessage());
			}
		}
	}



	public static void main(String argv[]){
		new Serveur();
	}
}